import torch
from torchvision import transforms
from torch import optim,nn
import torch.nn.functional as F
import matplotlib.pyplot as plt
from loader import load_CIFAR10
from models import ResNet

def show_pic(acc,epoch,save=False):
    x1 = range(0, epoch)
    y1 = acc
    plt.plot(x1, y1, 'o-')
    plt.title('Accuracy')
    plt.ylabel('Accuracy %')
    if save == True:
        plt.savefig("regularization/validation_acc_.jpg")



batch_size = 20
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")



if __name__ == '__main__':

    transform = transforms.ToTensor()
    test_data = load_CIFAR10("../datasets/",train = False, transforms=transform) #data and label as tensor
    acc_list = []

    net = ResNet.ResNet(ResNet.Residual_Block,[2,2,2,2],10)
    net.load_state_dict(torch.load('parameters/regularization/best_model.pt'))   
    
    acc = net.run(test_data,device)
    acc_list.append(acc)
    